package com.aloha.springframework.test.aop;

import com.aloha.springframework.stereotype.Component;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

/**
 * @author DaiZhiHeng
 * @date 2023/8/2 23:31
 */
@Aspect
@Component
public class LogAspect {


    @Around("@annotation(com.aloha.springframework.test.aop.SysLog)")
    public Object doLog(ProceedingJoinPoint joinPoint) {
        Object obj = null;
        try {
            System.out.println("====================");
            Object[] arg = new String[]{"Aloha"};
            obj = joinPoint.proceed(arg);
            System.out.println("====================");
        } catch (Throwable e) {
            e.printStackTrace();
        }
        return obj;
    }

}
